<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>管理系统</title>
    <style>
        /* 顶部样式 */
        .top-bar {
            height: 56px;
            background-color: #f8f9fa;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 15px;
            flex: 1;
            border-bottom: 1px solid #ccc;
        }

        .user-info {
            display: flex;
            align-items: center;
            gap: 10px;
            text-align: center;
        }

        .user-text {
            display: flex;
            flex-direction: column;
            align-items: flex-end;
            position: relative;
        }

        .welcome-text {
            font-size: 16px;
            color: #666;
            margin-bottom: 18px;
        }

        .username {
            font-size: 14px;
            font-weight: bold;
            color: #333;
            margin-top: 5px;
        }

        .avatar {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background-color: transparent;
            border: 1px solid #0d6efd; /* Bootstrap btn-outline-primary的边框颜色 */
            color: #0d6efd; /* Bootstrap btn-outline-primary的文本颜色 */
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
            transition: all 0.2s; /* 添加过渡效果 */
        }

        /* 添加悬停效果，与修改按钮保持一致 */
        .avatar:hover {
            background-color: #0d6efd; /* 悬停时背景色 */
            color: white; /* 悬停时文字颜色 */
        }

        .logout-btn {
            padding: 0.15rem 0.3rem;
            font-size: 0.8rem;
            line-height: 1.2;
            position: absolute;
            bottom: -10px;
            right: 0;
        }

        .avatar-container {
            display: flex;
            flex-direction: column;
            align-items: center;
        }
    </style>
</head>
<body>
<div class="top-bar">
    <h1>管理系统</h1>
    <div class="user-info" th:if="${session.username}">
        <div class="user-text">
            <span class="welcome-text">欢迎你!</span>
            <a class="btn btn-sm btn-outline-danger logout-btn" th:href="@{/logout}">退出</a>
        </div>
        <div class="avatar-container">
            <div class="avatar" th:text="${#strings.substring(session.username, 0, 1)}"></div>
            <span class="username" th:text="${session.username}"></span>
        </div>
    </div>
</div>
</body>
</html>